﻿@{
    ViewBag.Title = "CabinetListInfo";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<style>
    .sub_nav li a {
        width: 80px;
    }
</style>
<div class="mod_containter" style="height: 100%" id="idmod_containter">
    <div class="main" id="idmain">
        <div class="mod_load" id="mod_load">
            <div class="mod_hd" id="idmod_hd">
                <h2 class="title">设置</h2>
                <div style="float:right">
                    <a class="white" id="aLoginOut">退出登录</a>
                    &nbsp;&nbsp;
                    <script type="text/javascript">

                        $("#aLoginOut").click(function () {
                            top.window.location.href = "/";

                        }).mouseover(function () {

                            $("#aLoginOut").toggleClass("red");
                        });

                    </script>
                    <style>
                        .red {
                            color: red;
                            font-size: 14px;
                            cursor: pointer;
                        }

                        .white {
                            color: white;
                            font-size: 14px;
                            cursor: pointer;
                        }
                    </style>
                </div>
            </div>
            <div class="mod_bd">
                <div class="sub_nav" id="sub_nav">
                    <ul>
                        <li><a href="/Setting/CompanyInfo">公司信息管理</a></li>
                        <li><a href="/Setting/AccountUnregistered">未认证用户</a></li>
                        <li><a href="/Setting/Account">用户管理</a></li>
                        <li><a href="/Setting/RolePower">权限管理</a></li>
                        <li><a href="/Setting/MessageSet">消息设置</a></li>
                        <li class="on"><a href="/Setting/CabinetListInfo">智能单元</a></li>
                        <li><a href="/Setting/MaterialProductMode">产品领料设置</a></li>
                        <li><a href="/Setting/MaterialMachineMode">机床领料设置</a></li>
                        <li><a href="/Setting/MaterialList">物料信息</a></li>
                        <li><a href="/Setting/SafetyStock">安全库存</a></li>
                    </ul>
                </div>
                <div class="func_box" id="divBox">
                    <div class="inpt_box"> <input id="txtSearchContains" type="text" placeholder="请输入产品编号/子产品编号/柜号/默认物料" /> </div>
                    <div class="btn_box"> <button id="btnSearch" class="btn_green_m" data-type="reload"><i class="ico ico_bsearch"></i>搜索</button> </div>
                </div>
                <table id="infoList" style="width: auto; position: fixed; bottom:20px;"></table>
                
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        var height =$(window).height();;
        var idmod_hd = $("#idmod_hd").height();
        var sub_nav = $("#sub_nav").height();
        var divBox = $("#divBox").height();
        
        var content = parseFloat(height) - parseFloat(idmod_hd) - parseFloat(sub_nav) - parseFloat(divBox)  - 120;
        $("#infoList").css("height", content);
    });
</script>

<script>
   
    ////easyuui

    $(function () {

        $("#infoList").datagrid({
            url: '/Setting/CabinetDetail',
            loadMsg: '数据加载中请稍后……',
            pagination: true,
            rownumbers: true,
            idField: "CAB_ID",
            nowrap: false,
            fitColumns: true,
            columns: [[
         { field: 'PRODUCT_NO', title: '产品编号', width: "16%", align: "center" }
         , { field: 'SUBPRODUCT_NO', title: '子产品编号', width: "15%", align: "center" }
        , { field: 'CAB_NAME', title: '柜号', width: "10%", align: "center" }
        , { field: 'CAB_CODE', title: '柜号编码', width: "8%", align: "center" }
         , {
             field: 'opeaCAB_STATUS', title: '单元状态', width: "6%", fixed: 'right', align: 'center', formatter: function (value, row, index) {
                 return CAB_STATUS(row.CAB_STATUS);
             }
         }
        , {
            field: 'opeaCAB_TYPE', title: '单元类型', width: "6%", fixed: 'right', align: 'center', formatter: function (value, row, index) {
                return CAB_TYPE(row.CAB_TYPE);
            }
        }
        , { field: 'CAB_MARTERIAL', title: '默认物料', width: "22%", align: "left" }
        , { field: 'CAB_MARTERIAL_NUMBER', title: '默认数量', width: "8%", align: "center" }
        , { field: 'CAB_USER_NAME', title: '责任人', width: "8%", align: "center" }
        , {
            field: 'id', title: '操  作', width: "13%", fixed: 'right', align: 'center', formatter: function (value, row, index) {
                return "<a class='layui-btn layui-btn-xs' onclick=Edit(" + row.CAB_ID + ") >编辑</a>";
            }
        }
            ]],
            singleSelect: true,
            pageSize: 100,
            pageList: [20, 50, 100]
        });
    });

    function Edit(id) {
        var index = layer.open({
            anim: -1,
            title: !1,
            closeBtn: 1,
            type: 2,
            shadeClose: false,
            area: ['600px', '550px'],
            content: ['/Setting/CabinetEdit?width=-275px&action=edit&Id=' + id, 'no']
        })
    }

    $("#btnSearch").click(function () {
        var target = $("#infoList")[0];
        state = $.data(target, "datagrid");
        opts = state.options;
        opts.queryParams.SearchContains = $("#txtSearchContains").val();
        $("#infoList").datagrid("load", opts.queryParams);
    });

    function CAB_STATUS(flag) {
        value = "";
        switch(flag)
        {
            case 0: value = "启用"; break;
            case 1: value = "停用"; break;
            default: value = ""; break;
        }
        return value;
    }

    function CAB_TYPE(flag) {
        value = "";
        switch (flag) {
            case 0: value = "售卖"; break;
            case 1: value = "借还"; break;
            case 2: value = "回收"; break;
            default: value = ""; break;
        }
        return value;
    }

</script>
